<?php
class TestAction extends Action{
	public function index(){
		$parseTag = service ( 'ParseTag' );
		//$test_string = '';
		//var_dump($test_string);
		if(isset($_POST['test'])){
			$test = $parseTag->parse ( $_POST['test'],false );
		}
		
	//	$content = model('Widget')->getTemplateByWidgetId(24);

		$this->display();
	}
	public function blog(){
		$parseTag = service ( 'ParseTag' );
		//$test_string = '';
		//var_dump($test_string);
		if(isset($_POST['test'])){
			$test = $parseTag->parse ( $_POST['test'],false );
		}
		
	//	$content = model('Widget')->getTemplateByWidgetId(24);

		$this->display();
	}
	
	public function layout(){
		$this->display();	
	}

	public function preview(){
		$parseTag = service ( 'ParseTag' );
		$tagId = $_POST['tagId'];
		$tagModel = model('Widget');
		$tagName = $tagModel->getTagName($tagId);
		unset($_POST['tagId']);
		$param = $_POST;
		foreach ($param as $key => $value) {
			$attr[] = $key."=\"".$value."\"";
		}
		$widgetTags = sprintf('<%s %s/>',$tagName,implode(' ',$attr));
		//echo $widgetTags;
		$result = $parseTag->parse ( $widgetTags,true );
		echo $result;
	}
	
	public function previewScore(){
		$parseTag = service ( 'ParseTag' );
		$content = $_POST['content'];
		$result = $parseTag->parse ( $content,true,true );
		echo $result;
	}
}
?>